package com.changwu.cwbase.widget.banner;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;
import com.changwu.cwbase.R;
import com.changwu.cwbase.bean.model.BannerModel;
import com.changwu.cwbase.util.AppViewUtil;


/**
 * 网络图片加载例子
 */
public class NetworkImageHolderView implements Holder<BannerModel> {

    private Activity activity;
    private ImageView sdv;

    /**
     * @param activity
     */
    public NetworkImageHolderView(Activity activity) {
        super();
        this.activity = activity;
    }

    @Override
    public View createView(Context context) {
        // 你可以通过layout文件来创建，也可以像我一样用代码创建，不一定是Image，任何控件都可以进行翻页
        View tempView = activity.getLayoutInflater().inflate(R.layout.include_banner_image, null);
        sdv = (ImageView) tempView.findViewById(R.id.sdv);
        return tempView;
    }

    @Override
    public void UpdateUI(Context context, final int position, BannerModel data) {
        AppViewUtil.show(sdv, data.images.image);
    }
}